/*
 * @Author: huang liang miao 1127255342@qq.com
 * @Date: 2024-11-18 10:36:47
 * @LastEditors: huang liang miao 1127255342@qq.com
 * @LastEditTime: 2024-12-17 16:07:47
 * @FilePath: \dcy-webd:\webCode\dcyCode\scientific_research_manager_web\src\api\system\role.ts
 * @Description: 角色管理
 */
import request from '@/utils/request'
import {
  RoleListQuery,
  RoleListVO,
  RoleCreateReqDTO,
  RolePageQuery,
  PageBeanRolePageVO,
  AccountRoleDetailVO,
  RoleDetailVO,
} from './type'

// 查询角色列表
export function roleListReq(query?:RoleListQuery) {
  return request<RoleListVO[]>({
    url: '/resource/api/role/list',
    method: 'post',
    data: query
  })
}
// 角色创建
export function createRoleReq(query?:RoleCreateReqDTO) {
  return request({
    url: '/resource/api/role/create',
    method: 'post',
    data: query
  })
}

// 角色权限更新保存
export function updateRoleReq(query?:RoleCreateReqDTO) {
  return request({
    url: '/resource/api/role/update',
    method: 'post',
    data: query
  })
}

// 角色类型更新
export function updateRoleTypeReq(query?:RoleCreateReqDTO) {
  return request({
    url: '/resource/api/role/updateRole',
    method: 'post',
    data: query
  })
}

// 角色删除
export function deleteRoleReq(query?:{id: string}) {
  return request({
    url: '/resource/api/role/delete',
    method: 'post',
    data: query
  })
}

// 查询角色分页
export function rolePageReq(query?:RolePageQuery) {
  return request<PageBeanRolePageVO>({
    url: '/resource/api/role/page',
    method: 'post',
    data: query
  })
}
// 角色菜单权限
export function menuListRoleReq(query?:{roleIdList?: string[]}) {
  return request<AccountRoleDetailVO>({
    url: '/resource/api/menu/list',
    method: 'post',
    data: query
  })
}

// 角色菜单权限详情
export function roleDetailReq(id?: string) {
  return request<RoleDetailVO>({
    url: `/resource/api/role/detail/${id}`,
    method: 'post',
  })
}


